]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Make middle-click like Ctrl+click
authorXavier Johnson <krinkodot22@hotmail.com>
Tue, 29 May 2018 04:27:22 +0000 (00:27 -0400)
committerFlorian Müllner <florian.muellner@gmail.com>
Thu, 7 Jun 2018 17:49:36 +0000 (17:49 +0000)
When middle-clicking an app icon on the Dash, it will always try to open
a new window of that app, even if the app doesn't support multiple
windows. Meanwhile, Ctrl+click on an app will only open a new window if
the app allows it.

This change prevents middle-clicks on app icons from opening new windows
for apps without multi-window support.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/316
js/ui/appDisplay.js

index 2c4d2d1da498490d3a80fa668aa8127db3468074..2835c2aae3dcb92445b68ae3a9a16660e9fe884f 100644 (file)
@@ -1778,10 +1778,11 @@ var AppIcon = new Lang.Class({
     activate(button) {
         let event = Clutter.get_current_event();
         let modifiers = event ? event.get_state() : 0;
-        let openNewWindow = this.app.can_open_new_window () &&
-                            modifiers & Clutter.ModifierType.CONTROL_MASK &&
-                            this.app.state == Shell.AppState.RUNNING ||
-                            button && button == 2;
+        let isMiddleButton = button && button == Clutter.BUTTON_MIDDLE;
+        let isCtrlPressed = (modifiers & Clutter.ModifierType.CONTROL_MASK) != 0;
+        let openNewWindow = this.app.can_open_new_window() &&
+                            this.app.state == Shell.AppState.RUNNING &&
+                            (isCtrlPressed || isMiddleButton);
 
         if (this.app.state == Shell.AppState.STOPPED || openNewWindow)
             this.animateLaunch();